from requests_gpt import ImageAnalyzer
if __name__ == "__main__":
    import os
    from dotenv import load_dotenv
    load_dotenv()
    analyzer = ImageAnalyzer(
        api_key=os.getenv("DASHSCOPE_API_KEY") or "",
        # model="qvq-max"
    )
    local_dir = "/home/goldfish/ext/res/data/analysis/pdfs"
    base_url = "http://static.21729901.xyz/res/data/analysis/pdfs"

    pdf_analysis_results = analyzer.analyze_pdf_directory_http(
        local_dir, base_url)

    for pdf_name, description in pdf_analysis_results.items():
        print(f"{pdf_name} 的分析结果：\n{description}\n")
        with open(f"{pdf_name}.txt", "w", encoding="utf-8") as f:
            f.write(description)
